<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>人事档案</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/insdep/iconfont/iconfont.css' />">
<link href="<c:url value='/insdep/reset.min.css' />" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/easyui_full.css'/>" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/icon.css'/>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<c:url value='/insdep/jquery-1.11.3.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/jquery.easyui-1.5.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/insdep-extend.min.js'/>"></script>

</head>
<body>
<script type="text/javascript">

function note_bianji(val,row,index){
	var editor="";
	var Logrecord="";
	editor='<a class="easyui-linkbutton button-teal iconfont icon-hetongqicao" style="color:white;padding-left:9%;font-size:14px;padding-right:9%;margin-right:5%" onclick="editor('+index+')">编辑</a>';
	Logrecord='<a class="easyui-linkbutton button-blue iconfont icon-gongwenchaxun" style="color:white;padding-left:9%;font-size:14px;;padding-right:9%;margin-right:5%" onclick="Logrecord('+index+')">记录</a>';
	return editor+Logrecord;
}

</script>


<script type="text/javascript">
$(function(){
	//按条件查询用户
	 $("#checkPL").linkbutton({onClick:function(){ 
		 $('#loan_from').form('submit', {   
			 	
			    success:function(data){    //表单查询数据刷新DataGrid
			    	var resultData = $.parseJSON(data);  
			    	$('#loan_table').datagrid('loadData', resultData); 
			    }    
			}); 
	 }});
	
	 $("#reset_loan").linkbutton({
			onClick : function() {
				$("#loan_from").form('reset');
			}
		})
	 
})
</script>
<script type="text/javascript">
/**
	 *编辑事件
	 */
	function editor(index){
		$("#loan_win").window({
				  width: 500,
		          height: 350,
		          title: '编辑借款信息窗口',
		          iconCls: 'icon-update',
		          modal: true,//表示模式窗口
		          maximizable:false,
		          minimizable:false,
		          collapsible:false,
		          draggable: false ,
				  href:'editLoan',//请求远程数据
				});
		$('#loan_table').datagrid('selectRow',index);
	 	var row = $('#loan_table').datagrid('getSelected');
	 	alert(row.empId);
	 	var empId = row.empId;
		 $.post("editloanInfo", {empId:empId} ,function(info){
			 $('#editloan_from').form('load',info);
         });
 	    alert(row);
 	
 }
 
	function Logrecord(index){
		
		$("#loan_info_win").window({
				  width: 900,
		          height: 600,
		          title: '借款记录信息窗口',
		          iconCls: 'icon-update',
		          modal: true,//表示模式窗口
		          maximizable:false,
		          minimizable:false,
		          collapsible:false,
		          draggable: false ,
				  href:'loanlogInfo',//请求远程数据
				});
		$('#loan_table').datagrid('selectRow',index);
	 	var row = $('#loan_table').datagrid('getSelected');
		 $("#loan_info_win").window({
			 empId : row.empId
		 })
			$.post("loanlogempInfo", {empId:row.empId} ,function(info){
				 $('#loanlog_Info_table').datagrid('loadData', info); 
		   });
 }
 
</script>
<script type="text/javascript">
$(function() {  
    //导出excel表  
    $('#daochu').on('click',function(){                     
        exportExcel();  
    });  
});  
  
function exportExcel() {  
        $.messager.confirm('确认', '确认把该搜索结果导出Excel表格 ？', function(r) {  
        if (r) {  
            $.messager.progress({  
                title : '处理中',  
                msg : '请稍后',  
            });  
            $.messager.progress('close');  
            location.href="loanlogDaohu.xls";  
        }  
    });   
}

</script>


<div class="easyui-layout theme-layout" data-options="fit:true">
    <div class="theme-header-layout" style="height:70px;border: 0px solid red" data-options="region:'north'">
    	<div style="margin-left: 1%;width:98%;margin-top:20px;border: 0px solid green">
        <form action="loanEmpInfo" id="loan_from" class="searcher-form" method="post">
    		<input id="empName" name="empName" class="easyui-textbox"  style="width: 20%;"  labelAlign="right" label="姓名：" labelWidth="60px"> 
			<input id="deptName" name="deptName" class="easyui-textbox"  style="width: 23%;"  labelAlign="right" label="部门：" labelWidth="70px"> 
			<a id="checkPL"  class="easyui-linkbutton button-line-blue" 
			style="width: 9%;height: 30px;margin-left: 6%;"><i class="iconfont icon-roundcheck"></i>查询</a>
    		<a id="reset_loan"  class="easyui-linkbutton button-line-blue return" 
			style="width: 9%;height: 30px;margin-left: 6%;"><i class="iconfont icon-refresh"></i>重置</a>
    		<a id="daochu"  class="easyui-linkbutton button-line-blue" 
			style="width: 9%;height: 30px;margin-left: 6%;"><i class="iconfont icon-pulldown"></i>导出</a>
    	</form>
    	</div>
    </div>
    <div class="theme-center-layout" style="border: 0px solid red;" data-options="region:'center',title:'借款信息表'">
        <!-- <div style="margin-left: 12%;margin-right:5%;margin-top:20px;border: 0px solid red"> -->
        <!--  class="table table-striped" -->
        <table id="loan_table" style="width:100%;height: 100%" class="easyui-datagrid" 
		data-options="
		height:450,
		url:'loanEmpInfo',
		singleSelect:true,
        collapsible:true,
        method:'get'
		">
	<thead>
		<tr>
			
			<th style="font-weight: 700;width: 28%" align="center" data-options="field:'deptName'">部门名称</th>
			<th style="font-weight: bold;width: 28%" align="center" data-options="field:'empName'">员工姓名</th>
			<th style="font-weight: 700;width: 28%" align="center" data-options="field:'empLoanbalance'">借款余额</th>
			<th field="note" style="font-weight: bold;width: 18%;" align="center" data-options="formatter:note_bianji">操作</th>
		</tr>
	</thead>
</table>
<!-- </div> -->

    </div>

</div>
<div id="loan_win"></div>
<div id="loan_info_win"></div>
</body>
</html>